<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
</head>
<body>
    <canvas id="canvas" width="500" height="500" style="border: 1px solid #ccc;"></canvas>

</body>
</html>

<script type="text/javascript">
	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	context.shadowBlur = 10;
	//模糊度
	context.shadowOffsetX=20;
	//向左偏移
	context.shadowOffsetY=30;
	//向下偏移
	context.shadowColor = 'black';
	//阴影颜色
	context.fillStyle = 'red';
	context.fillRect(30,30,200,100)
</script>